package com.xuelang.pipeline.client.pipeline.enums;

import lombok.Getter;

/**
 * @author liuyuan.ly
 * @since 2024/8/10 15:02
 */
@Getter
public enum DeployUnitEnum {
    zero("0", "已回滚"),
    First("1", "第一批发布"),

    Second("2", "第二批发布"),

    Third("3", "第三批发布"),

    Fourth("4", "第四批发布"),

    Fifth("5", "第五批发布");

    private String key;
    private String name;

    DeployUnitEnum(String key, String name) {
        this.key = key;
        this.name = name;
    }

    public static DeployUnitEnum fromKey(String key) {
        for (DeployUnitEnum deployUnitEnum : values()) {
            if (deployUnitEnum.key.equals(key)) {
                return deployUnitEnum;
            }
        }
        throw new IllegalArgumentException("Invalid value: " + key);
    }
}
